<script type="text/javascript">
function calendar_onchange(){
	// change calendar date	
	document.f.submit();
}

// for ajax show
function show_todo(id, url) {
	if (Element.empty(id)) {
          new Ajax.Updater(id, url, {
            method:     'get',
            onFailure:  function() {Element.classNames(id).add('failure')},
            onComplete: function() {new Effect.BlindDown(id, {duration: 0.25})}
          });
    } else {
          new Effect[Element.visible(id) ? 
            'BlindUp' : 'BlindDown'](id, {duration: 0.25});
    }
}
</script>
<% form_tag( {:action => 'index', :move => 0}, :id=>'f', :name=>"f") do %>
﻿	﻿<div class=head>日报汇总 - 
	<input name="seldate" type="text" id="date" onclick="new Calendar().show(this);" size="9" maxlength="10" readonly="readonly"
	value="<%= session[:date].strftime("%Y-%m-%d")%>" /></div>
	<input type='submit' style='display:none' />
<% end %>
<div class=menu>
<%= link_to '前一天', :action => 'index', :move => -1 %> |
<%= link_to '今天', :action => 'index', :today => 1 %> |
<%= link_to '下一天', :action => 'index' , :move => 1 %> 
<hr size=1 />
</div>

<div class=area>
<ul>
  <% for user in @all_users %>
    <li>
    <%= link_to_remote( "#{user.name}[#{user.full_name}]",
:update => "about-content-#{user.id}",
:url =>{ :action => :show_user_todos, :id=> user.id},
:layout=>false,
:complete => "new Effect[Element.visible('about-content-#{user.id}') ? 'BlindUp' : 'BlindDown']('about-content-#{user.id}', {duration: 0.25});" )
 %>
<!---        <a href="#" onclick="show_todo('about-content-<%= user.id%>', 'rails/info/properties'); return false;"><%= h(user.name) %>[<%= h(user.full_name) %>]</a> --> 
——          
        <%= user.todos.count(:all, :conditions => ["create_for_date = ?", session[:date]]) %> 项任务， 已完成 <%= user.todos.count(:all, :conditions => ["create_for_date = ? and check_state = 1", session[:date]]) %> 项。
    </li>
	<div class="about-content" id="about-content-<%=user.id%>" style="display: none"></div>
  <% end %>
</ul>
</div>